export const isFalsy = (value: unknown) => (value === 0 ? false : !value)

// 在一个函数里，改变传入的对象是不好的
export const cleanObject = (object: object) => {
  const result = { ...object }
  Object.keys(result).forEach(key => {
    // @ts-ignore
    const value = result[key]
    if (isFalsy(value)) {
    // @ts-ignore
      delete result[key]
    }
  })
  return result
}
